import { Component, OnInit } from '@angular/core';
import { AxiosService } from '../../axios.service';


@Component({
  selector: 'app-zongjian-process',
  templateUrl: './zongjian-process.component.html',
  styleUrls: ['./zongjian-process.component.scss']
})
export class ZongjianProcessComponent implements OnInit {
  listOfData;
  splitJudge: string = ',';


  constructor(public axios: AxiosService) { }

  ngOnInit(): void {
    this.getData();
  }

  // 请求数据
  getData() {
    this.axios.axiosPost('QuerySegmentSchedule', { segment: 'zongjian' })
      .then((data) => {
        this.listOfData = data['order'];
        this.listOfData.sort((a, b) => {
          return a.delivery_date > b.delivery_date ? 1 : -1;
        });
        for (let i = 0; i < this.listOfData.length; i++) {
          if (this.listOfData[i].ng_count != '' || this.listOfData[i].ng_count != '') {
            this.listOfData[i].ng_count = Number(this.listOfData[i].ng_count);
            this.listOfData[i].ok_count = Number(this.listOfData[i].ok_count);
          }
          // this.listOfData[i].quatity_total = Number(this.listOfData[i].quatity_total);
        }
        console.log(this.listOfData);
      })
      .catch((err) => {
        console.log(err);
      });
  }
}
